/* src/App.css */

/* 基础重置 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

/* 全局样式 */
body {
  background: #f5f7fb;
  color: #2d3436;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* 导航栏 */
nav {
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-link {
  color: #636e72;
  text-decoration: none;
  margin-right: 2rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.nav-link:hover {
  background: #f1f3f6;
  color: #2d3436;
}

/* 代码列表 */
.snippet-list {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.snippet-item {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 3px 6px rgba(0,0,0,0.05);
  transition: transform 0.2s ease;
}

.snippet-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.snippet-item h3 {
  color: #2d3436;
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

/* 按钮样式 */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  font-size: 0.9rem;
}

.btn.view {
  background: #74b9ff;
  color: white;
}

.btn.edit {
  background: #55efc4;
  color: white;
}

.btn.delete {
  background: #ff7675;
  color: white;
}

.btn:hover {
  opacity: 0.9;
  transform: scale(0.98);
}

/* 表单样式 */
.snippet-form {
  max-width: 600px;
  margin: 2rem auto;
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.05);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #636e72;
  font-weight: 500;
}

input[type="text"],
textarea,
select {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #dfe6e9;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #74b9ff;
  box-shadow: 0 0 0 3px rgba(116, 185, 255, 0.2);
}

textarea {
  resize: vertical;
  min-height: 150px;
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
}

/* 代码详情页 */
.snippet-detail {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.05);
}

pre {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 4px;
  overflow-x: auto;
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 1rem 0;
}

/* 加载状态 */
.loader {
  display: flex;
  justify-content: center;
  padding: 2rem;
  color: #74b9ff;
}

/* 错误提示 */
.error {
  background: #ff7675;
  color: white;
  padding: 1rem;
  border-radius: 4px;
  margin: 2rem 0;
}

/* 空状态提示 */
.empty {
  text-align: center;
  color: #636e72;
  padding: 2rem;
  border: 2px dashed #dfe6e9;
  border-radius: 8px;
  margin: 2rem 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  
  .snippet-list {
    grid-template-columns: 1fr;
  }
  
  nav {
    padding: 1rem;
  }
  
  .nav-link {
    margin-right: 1rem;
  }
}